import request from "@/utils/request";

const path = '/department'

// 新增部门
export const addDepartment = (data) => {
    return request({
        url: path,
        method: 'post',
        data
    })
}
// 分页查询部门
export const queryDepartmentPage = (params) => {
    return request({
        url: path,
        method: 'get',
        params
    })
}

// 根据ID查询部门
export const queryDepartmentById = (id) => {
    return request({
        url: path + `/${id}`,
        method: 'get'
    })
}

// 修改部门
export const updateDepartment = (data) => {
    return request({
        url: path,
        method: 'put',
        data
    })
}
// 修改部门状态 
export const updateDepartmentStatus = (data) =>
    request({
        'url': path + `/status/${data.status}`,
        'method': 'put',
        params: { id: data.id }
    })

// 删除部门
export const deleteDepartmentById = (id) =>
    request({
        'url': path,
        'method': 'delete',
        params: { id }
    })